using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Campus
{
    class CollegeOfEngineering : Structure
    {
        static public Texture2D BuildingTexture { get; private set; }
        static public Texture2D StaticTeamColorTexture { get; private set; }
        static public Texture2D ConstructionTexture { get; private set; }
        static public Vector2 StaticOrigin { get; private set; }
        static public List<Vector2> StaticTilesOccupied { get; private set; }
        static public void InitializeTextures(ContentManager Content) {
            BuildingTexture = Content.Load<Texture2D>("Structures/building_coe_base");
            StaticTeamColorTexture = Content.Load<Texture2D>("Structures/building_coe_team");
            ConstructionTexture = Content.Load<Texture2D>("Structures/building_coe_build");
            StaticOrigin = new Vector2(94, 227);
            // Set up the tiles that get turned into walls when building is placed.
            StaticTilesOccupied = new List<Vector2>();
            StaticTilesOccupied.Add(new Vector2(0, 0));  // Tile building is placed on.
            StaticTilesOccupied.Add(new Vector2(0, 1));
            StaticTilesOccupied.Add(new Vector2(0, 2));
            StaticTilesOccupied.Add(new Vector2(1, 0));
            StaticTilesOccupied.Add(new Vector2(1, 1));
            StaticTilesOccupied.Add(new Vector2(1, 2));
            StaticTilesOccupied.Add(new Vector2(2, 0));
            StaticTilesOccupied.Add(new Vector2(2, 1));
            StaticTilesOccupied.Add(new Vector2(2, 2));
        }
 
        private void CreateAbilities() {
            Abilities.Add("Build Mechanical Engineer", new BuildUnitAbility(MenuIcons.BuildMechanicalEngineerIcon, this, BuildRequirements.Units.MechanicalEngineer));
        }
        public CollegeOfEngineering(Player player, Level level)
            : base(BuildingTexture, StaticTeamColorTexture, ConstructionTexture, StaticTilesOccupied, StaticOrigin, Vector2.Zero, 500, player, level, new Dictionary<String, Ability>(), new Dictionary<string,AbilitySubMenu>())
        {
            m_name = "College of Engineering";
            player.AddMaxFood(10);
            CreateAbilities();

            // TODO: Create Nexus Abilities / Submenus

        }
        protected override void Destroy()
        {
            PlayerOwner.AddMaxFood(-10);
            base.Destroy();
        }
        public override string ToString()
        {
            string returnString = m_name + "\n" +
                                  "HP: " + m_currentHP + "/" + m_maxHP + "\n" + 
                                  "The College of Engineering is your primary building.  It provides 10 food and builds Mechanical Engineers and Pre-Med Students.";
            return returnString;
        }
        public override void Update(Player player)
        {
        }
    }
}